package exam.test18;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Endstart
 * Date: 2020-12-18
 * Time: 23:31
 */
public class SpecialString implements Comparable<SpecialString>{

    private String str = null;
    public SpecialString(String str) {
        str = this.str;
    }

    public String toString() {
        return str;
    }

    public int compareTo(SpecialString o) {
        String str1 = str;
        String str2 = o.str;

        if (str1.startsWith("A")) {
            str1 = str1.replaceFirst("A", "");
        } else if (str1.startsWith("The")) {
            str1 = str1.replaceFirst("The", "");
        }

        if (str2.startsWith("A")) {
            str2 = str2.replaceFirst("A", "");
        } else if (str1.startsWith("The")) {
            str2 = str2.replaceFirst("The", "");
        }

        str1 = str1.trim();
        str2 = str2.trim();

        return str1.compareTo(str2);
    }

    public static void main(String[] args) {
        int a[] = new int[5];
        System.out.println(a[6]);
    }

}
